package com.example.shopping.controller;

import com.example.shopping.pojo.Carts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: TODO
 * @author: uu
 * @data: 2023/6/29 19:14
 * @version: v1.0
 */
@RestController
public class CartsController {

    @Autowired
    com.example.shopping.service.Carts cart;
    /**
     * @Description: 添加到购物车
     * @auther: uu
     * @date: 2023/6/29 19:25
     */
    @GetMapping("/addCarts")
    public String addCarts(Carts carts){
        Boolean aBoolean = cart.addCarts(carts);
        return aBoolean ? "true" : "false";
    }
    @GetMapping("/showCarts")
    public List<Carts> showCarts(){
        List<Carts> all = cart.findAll();
        return all;
    }

}
